package br.com.guiav6.sisguia.entity;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@Table(name = "TB_EMPRESA")
public class Empresa implements PersistentObject{
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "ID_EMPRESA", unique = true, nullable = false)
	private Long id;
	
	@Column(name = "NOME_FANTASIA")
	private String nomeFantasia;
	
	@Column(name = "RAZAO_SOCIAL")
	private String razaoSocial;
	
	@Column(name = "CNPJ_CPF")
	private String cnpjCpf;
	
	private String email;
	
	private String site;
	
	@Column(name = "IND_ATIVO")
	private Character indAtivo;
	
	@Column(name = "DT_CADASTRO", nullable = false, columnDefinition = "TIMESTAMP DEFAULT now()")
	private Date dtCadastro;
	
	@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER, optional = true)
	@JoinColumn(name = "ID_ENDERECO")
	private Endereco endereco;
	
	@OneToMany(mappedBy = "empresa", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	private List<Telefone> telefoneList;
	
	@OneToMany(mappedBy = "empresa", fetch = FetchType.LAZY,
			cascade = {CascadeType.PERSIST, CascadeType.MERGE})
	private List<TipoServicoEmpresa> tipoServicoEmpresaList;
	
	@Transient
	private Long idBairro;
	
	@Transient
	private String pathMapa;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getNomeFantasia() {
		return nomeFantasia;
	}

	public void setNomeFantasia(String nomeFantasia) {
		this.nomeFantasia = nomeFantasia;
	}

	public String getRazaoSocial() {
		return razaoSocial;
	}

	public void setRazaoSocial(String razaoSocial) {
		this.razaoSocial = razaoSocial;
	}

	public String getCnpjCpf() {
		return cnpjCpf;
	}

	public void setCnpjCpf(String cnpjCpf) {
		this.cnpjCpf = cnpjCpf;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getSite() {
		return site;
	}

	public void setSite(String site) {
		this.site = site;
	}

	public Character getIndAtivo() {
		return indAtivo;
	}

	public void setIndAtivo(Character indAtivo) {
		this.indAtivo = indAtivo;
	}

	public Date getDtCadastro() {
		return dtCadastro;
	}

	public void setDtCadastro(Date dtCadastro) {
		this.dtCadastro = dtCadastro;
	}

	public Endereco getEndereco() {
		return endereco;
	}

	public void setEndereco(Endereco endereco) {
		this.endereco = endereco;
	}

	public List<Telefone> getTelefoneList() {
		return telefoneList;
	}

	public void setTelefoneList(List<Telefone> telefoneList) {
		this.telefoneList = telefoneList;
	}

	public List<TipoServicoEmpresa> getTipoServicoEmpresaList() {
		return tipoServicoEmpresaList;
	}

	public void setTipoServicoEmpresaList(List<TipoServicoEmpresa> tipoServicoEmpresaList) {
		this.tipoServicoEmpresaList = tipoServicoEmpresaList;
	}

	public Long getIdBairro() {
		return idBairro;
	}

	public void setIdBairro(Long idBairro) {
		this.idBairro = idBairro;
	}

	public String getPathMapa() {
		return pathMapa;
	}

	public void setPathMapa(String pathMapa) {
		this.pathMapa = pathMapa;
	}
	
}